package com.zelin.service.impl;

import com.zelin.dao.UserDao;
import com.zelin.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    @Override
    public void trans(int from, int to, int money) {
        //转出
        userDao.updateAccount(from, money);
        int i = 10 / 1;
        //转入
        userDao.updateAccount(to,-money);
    }
}
